<?php
require $this->website['path']['action'] . '/admin/islogin.php';
// 获取分类信息

$upid = fn_post('upid') ?? 0;
$json = array('status' => 'ok', 'msg' => 'ok', 'data' => '');

$data = $this->website['class']['db']
	->table('type')
	->where('upid=?', $upid)
	->select();

foreach ($data as &$v) {
	$v['num'] = $this->website['class']['db']
		->table('type')
		->where('upid=?', $v['id'])
		->count();
	// if($v['upid']=='0'){
	// $v['uptit']='所有分类';
	// }else{
	$arr = $this->website['class']['db']
		->table('type')
		->field('tit')
		->where('id=?', $v['upid'])
		->one();
	$v['uptit'] = $arr['tit'];
	// }
}

$json['sql'] = $this->website['class']['db']->sql;
$json['data'] = $data;

echo json_encode($json);